package ae.pcfc.cldos.online.common.facade.provider;

import java.util.ArrayList;
import java.util.List;

import org.springframework.transaction.annotation.Transactional;

import ae.pcfc.cldos.online.common.facade.BaseFacade;
import ae.pcfc.cldos.online.common.facade.CountryFacade;
import ae.pcfc.cldos.online.common.tscdb.domain.TTscCountry;
import ae.pcfc.cldos.online.common.tscdb.domain.manager.TTscCountryDOM;
import ae.pcfc.cldos.online.common.vo.selectors.CountryVO;

public class CountryFacadeImpl extends BaseFacade implements CountryFacade {

	private TTscCountryDOM countryDomainObjectManager;
	
	public void setCountryDomainObjectManager(TTscCountryDOM countryDomainObjectManager) {
		this.countryDomainObjectManager = countryDomainObjectManager;
	}
	
	@Transactional
	public List<CountryVO> getCountriesVOList(){
		List<TTscCountry> countryList = countryDomainObjectManager.getCountriesList();
		
		List<CountryVO> result = new ArrayList<CountryVO>(countryList.size());
		
		for(TTscCountry tscCountry : countryList){
			CountryVO countryVO = new CountryVO();
			getMapper().map(tscCountry, countryVO);
			result.add(countryVO);
		}
		
		return result;
	}
}
